package jmine.tec.persist.hibernate.proxy;

import java.lang.reflect.Method;

import javassist.util.proxy.MethodFilter;

/**
 * Filtro que evita proxy do método {@link #finalize()}.
 * 
 * @author wellington.santos
 * @created May 30, 2012
 */
public class FinalizeFilter implements MethodFilter {

    public static final FinalizeFilter INSTANCE = new FinalizeFilter();

    /**
     * {@inheritDoc}
     *
     * @return {@inheritDoc}
     */
    public boolean isHandled(Method m) {
        return !(m.getParameterTypes().length == 0 && m.getName().equals("finalize"));
    }

}
